package web.hibernate;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Basic;
import javax.persistence.Column;
import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 * User: user
 * Date: Jan 31, 2010
 * Time: 9:14:55 PM
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(catalog = "strutshibernatespring", name = "country")
public class CountryEntity {
  private long cntryId;

  @Basic
  @Column(name = "cntry_id", length = 10)
  public long getCntryId() {
    return cntryId;
  }

  public void setCntryId(long cntryId) {
    this.cntryId = cntryId;
  }

  private char[] cntryRfn;

  @Basic
  @Column(name = "cntry_rfn", length = 500)
  public char[] getCntryRfn() {
    return cntryRfn;
  }

  public void setCntryRfn(char[] cntryRfn) {
    this.cntryRfn = cntryRfn;
  }

  private char[] cntryRsn;

  @Basic
  @Column(name = "cntry_rsn", length = 4)
  public char[] getCntryRsn() {
    return cntryRsn;
  }

  public void setCntryRsn(char[] cntryRsn) {
    this.cntryRsn = cntryRsn;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    CountryEntity that = (CountryEntity) o;

    if (cntryId != that.cntryId) return false;
    if (!Arrays.equals(cntryRfn, that.cntryRfn)) return false;
    if (!Arrays.equals(cntryRsn, that.cntryRsn)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = (int) (cntryId ^ (cntryId >>> 32));
    result = 31 * result + (cntryRfn != null ? Arrays.hashCode(cntryRfn) : 0);
    result = 31 * result + (cntryRsn != null ? Arrays.hashCode(cntryRsn) : 0);
    return result;
  }
}
